package com.apes.framework.plugin.condition.repository;

import com.apes.framework.jpa.repository.CustomRepository;
import com.apes.framework.plugin.condition.model.ConditionField;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * 条件字段
 *
 * @author wuq
 * @create 2018-11-12 16:06
 */
public interface ConditionFieldRepository extends CustomRepository<ConditionField, String> {


    @Query("SELECT T FROM ConditionField T WHERE 1 = 1 and (T.id like %:id% or T.name like %:value%) ")
    Page<ConditionField> find(@Param("id") String id, @Param("value") String value, Pageable pageable);

    /*@Query(value = "select f from ConditionTable c inner join c.conditionTableItems t inner join t.conditionField f where c.id = ?1")
    List<ConditionField> findAllByConditionTableId(String conditionTableId);*/

}
